<?php
namespace app\console\controller;
use app\model\DeviceRent as SelfModel;
use app\model\LeasingCompany;
use app\model\Project;

use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\facade\Request;
use think\facade\Route;
use think\facade\Session;
use think\facade\View;
use think\facade\Db;
use think\facade\Cache;
use think\facade\Cookie;
class DeviceRent extends Base
{



    public function initialize()
    {
        parent::initialize();
        $this->model = "\app\model\DeviceRent";
        $this->list_rows = 20;
        $this->where = [['company_id','in',Session::get('data_id_str')]];
        if(!empty(input('company_id'))){
            $this->where = [['company_id','in',input('company_id')]];
        }
        
    }
    public function select()
    {
        $where = [['id','in',Session::get('data_id_str')]];

        $leasing_company = LeasingCompany::order([ 'id' => 'desc'])->where($where)->select()->toArray();
        View::assign('leasing_company', $leasing_company);
            $project = Project::order([ 'id' => 'desc'])->where($this->where)->select()->toArray();
            View::assign('project', $project);

    }






}